<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreatePaperQuestionsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('paper_questions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('paper_id')->default(0)->index()->comment('问卷id');
            $table->unsignedBigInteger('admin_id',false)->default(0)->comment('管理员id');
            $table->string('title',255)->comment('题目标题');
            $table->string('image',200)->nullable()->comment('题目图片');
            $table->unsignedTinyInteger('type',false)->default(1)->comment('题目类型 1=判断题 2=单选题 3=多选题');
            $table->text('explain')->nullable()->comment('题目解析');
            $table->text('answers')->comment('题目答案json字符串');
            $table->string('right_result',30)->nullable()->comment('正确答案');
            $table->unsignedTinyInteger('score',false)->default(0)->comment('试题分值');
            $table->unsignedInteger('listorder',false)->default(0)->comment('排序');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('paper_questions');
    }
}
